package com.demomaster.quickaccessibility.service;

import android.view.accessibility.AccessibilityNodeInfo;

/**
 * 为了便于传输 事件类型喝node信息过大问题 构造新的实体
 */
public class QuickAccessibilityEvent {
    private int eventType;
    private Long nodeHashCode;
    private String packageName;
    private String className;

    public QuickAccessibilityEvent(android.view.accessibility.AccessibilityEvent accessibilityEvent) {
        this.eventType = accessibilityEvent.getEventType();
        this.packageName = accessibilityEvent.getPackageName()+"";
        this.className = accessibilityEvent.getClassName()+"";
        AccessibilityNodeInfo accessibilityNodeInfo = accessibilityEvent.getSource();

        if(accessibilityNodeInfo!=null) {
            this.nodeHashCode = Long.parseLong("" + accessibilityNodeInfo.hashCode());
            //accessibilityNodeInfo.recycle();
        }
    }

    public int getEventType() {
        return eventType;
    }

    public void setEventType(int eventType) {
        this.eventType = eventType;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Long getNodeHashCode() {
        return nodeHashCode;
    }

    public void setNodeHashCode(Long nodeHashCode) {
        this.nodeHashCode = nodeHashCode;
    }
}
